import { _decorator, Component, input, Input, Label } from 'cc'
import { IRoom } from '../Common'
import { EventEnum } from '../Enum'
import EventManager from '../Global/EventManager'
const { ccclass } = _decorator

// 在房间列表的单个
@ccclass('RoomManager')
export class RoomManager extends Component {
  id: number

  init({ id, players }: IRoom) {
    this.id = id
    const label = this.getComponent(Label)
    label.string = `房间号${id}`
    this.node.active = true
  }
  // 点击触发加入房间
  handleClick() {
    EventManager.Instance.emit(EventEnum.RoomJoin, this.id)
  }
}
